#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int i,n;
    float beg,end,h,f(float);
    cout<<"Enter the no. of intervals"<<endl;
    cin>>n;
    cout<<"Enter the end points"<<endl;
    cin>>beg>>end;
    h=(end-beg)/float(n);
    float sum1,sum2,sum;
    sum1=f(beg)+f(end);
    sum2=0;
    for(i=1;i<=n-1;i+=2)
    {
        sum1=sum1+4.0*(f(beg*(+i*h)));
    }
    for(i=2;i<=n-2;i+=2)
    {
        sum2=sum2+2.0*(f(beg+i*h));
    }
    sum=(sum1+sum2)*h/3.0;
    cout<<"The integral="<<sum<<endl;
    cin.get();
}

float f(float x)
{
    return(x*x*x);
}
